/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2009-8-15
 * Time: 18:40:22
 * To change this template use File | Settings | File Templates.
 */




//树控件
var tree = new Ext.tree.TreePanel({
    containerScroll: true,
    region:'center',
    rootVisible:false,//不显示跟菜单
    lines:false,
    useArrows:true,
    root:new Ext.tree.AsyncTreeNode({
        text:"根节点",
        id:"sm_view_tree_root",
        children:[
            {
                text:"项目管理",
                id:"sm_view_tree_1",
                expanded:true,
                leaf:true,
                //是跟节点
                listeners:{
                    "click":function(n, e) {
                        new Faceye.load(basePath + "jscore/test/test.js");//动态载入JS文件
                        addTabPanel(this, path + "/gft/bottom_login.html");
                    }
                }

            }
        ]
    })
});

//向tabPanel内，添加一标签页
var addTabPanel = function (obj, uri) {
    if (!tabPanel.getComponent("tabPanel_" + obj.id)) {//判断是否加载过此标签页
        tabPanel.add({
            title:"数据表管理",
            id:"tabPanel_" + obj.id,
            closable:true,
            autoLoad:{//ajax异步载入
                url:uri,
                text:"载入中。。。"
            }
        });
    }
    tabPanel.setActiveTab("tabPanel_" + obj.id);
}


var tabPanel = new Ext.TabPanel({
    id:"sm_view_tabPanel",
    region:'center',
    autoScroll:true,
    margins:'35 5 5 0',
    activeTab:0,
    frame:true,
    items:[
        {
            title:"欢迎",
            id:"sm_view_tabPanel_tab1"
            /*autoLoad:{
             url:"/jscore/test/test.jsp",
             loadScripts:true,
             text:"载入中。。。"
             },*/
        }
    ]
});


//Ext载入初始
Ext.onReady(function() {
    var viewport = new Ext.Viewport({
        layout:'border',
        items:[
            {
                region:'west',
                id:'sm_view_west',
                title:'功能菜单',
                split:true,
                width: 200,
                minSize: 175,
                maxSize: 400,
                collapsible: true,
                margins:'35 0 5 5',
                cmargins:'35 5 5 5',
                layout:"border",
                defaults: {
                    collapsible: true,
                    split: true
                }
            },
            tabPanel
        ]
    });


    new Faceye.load(basePath + "jscore/test/test.js");
    var up = Ext.get("欢迎").getUpdater();
    up.update({
        url:basePath + "jscore/test/test.jsp",
        text:"载入中。。。"
    });

});